﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using HST.Infrastructure.Data.Seedwork;

namespace HST.ZWParking.Infrastructure.Data.EntityFramework
{
    public class DatabaseFactory : Disposable, IDatabaseFactory
    {
        private IDataContext _dataContext;
        public IDataContext Create()
        {
            return _dataContext ?? (_dataContext = (IDataContext)new ZWParkingContext());
        }

        protected override void DisposeCore()
        {
            if (_dataContext != null)
            {
                _dataContext.Dispose();
            }
        }
    }
}
